using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class So_FeesPlansMap : EntityTypeConfiguration<So_FeesPlans>
    {
        public So_FeesPlansMap()
        {
            // Primary Key
            this.HasKey(t => new { t.id, t.name, t.percentage });

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.percentage)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.exceptions)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("So_FeesPlans");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.name).HasColumnName("name");
            this.Property(t => t.percentage).HasColumnName("percentage");
            this.Property(t => t.exceptions).HasColumnName("exceptions");
        }
    }
}
